<!--    TABLE html5_blog__categories
    (
        cat_id bigint NOT NULL AUTO_INCREMENT,
        cat_parent_id bigint DEFAULT '0' NOT NULL,
        cat_title text NOT NULL,
        cat_description longtext NOT NULL,
        cat_status INT(1),
        cat_created_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
        PRIMARY KEY (cat_id)
    )-->


<?php
class Category_model extends CI_Model {
	
	private $html5_blog__categories= 'html5_blog__categories';
	
	function __construct(){
		parent::__construct();
	}
	
	function list_all(){
		$this->db->order_by('id','asc');
		return $this->db->get($html5_blog__categories);
	}
	
	function count_all(){
		return $this->db->count_all($this->html5_blog__categories);
	}
	
	function get_paged_list($limit = 10, $offset = 0){
		$this->db->order_by('id','asc');
		return $this->db->get($this->html5_blog__categories, $limit, $offset);
	}
	
	function get_by_id($id){
		$this->db->where('id', $id);
		return $this->db->get($this->html5_blog__categories);
	}
	
	function save($person){
		$this->db->insert($this->html5_blog__categories, $person);
		return $this->db->insert_id();
	}
	
	function update($id, $person){
		$this->db->where('id', $id);
		$this->db->update($this->html5_blog__categories, $person);
	}
	
	function delete($id){
		$this->db->where('id', $id);
		$this->db->delete($this->html5_blog__categories);
	}
}
?>